package com.project.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import com.aliyun.oss.OSSClient;

public class OSSUtil {
	private static final String ENDPOINT = "http://oss-cn-shenzhen.aliyuncs.com"; //oss上传服务器域名
	private static final String ACCESSKEYID = "knC3xQSgX3qMJ5q1";//keyId
	private static final String ACCESSKEYSECRET = "iIydFFf161hF8vBJtMKxIvTyHw26c6";//密钥
	public static final String IMAGE_BUCKETNAME = "yunxi-yxs";//存放图片

	
	public static OSSClient getOSSClient(){
		return new OSSClient(ENDPOINT, ACCESSKEYID, ACCESSKEYSECRET);
	}
	
	
	private static String displayTextInputStream(InputStream input) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(input));
		String str="";
		try {
	        while (true) {
	            String line = reader.readLine();
	            if (line == null) {
	            	break;
	            }
	            str+=line;
	        }
		} catch (IOException e) {
			// TODO: handle exception
			e.printStackTrace();
		}finally {
			try {
				reader.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}finally {
				reader = null;
			}
		}
		 return str;
    }
	

}
